Skip to main content

Environment Variables

Environment Variables are the variables/constants which can be accessed in the Widget Designer.

info

Environment Variables names have to be alphanumeric, SNAKE_CASED and without spaces.

tip

It is good practice to make the variable name ALL_CAPS_SNAKED_CASED to indicate that it is a constant.

Public Variables

These are the inputs of the Widget, which allows the user of the Widget to specify customization options. Once added, it will appear in the Widget Designer as a variable in the Widget function signature.

info

Public variables are set by users installing the Widget. They are not set by the author of the Widget.

Testing

For testing purposes, you can specify a value to mimic the user using your Widget. This is handy for development. If a value is not set, a default value is set instead.

Variable Types

Different variable types are available to help the user customize the Widget customize more effectively.

String

Simple text field for the user to enter.

This has ultimate flexibility but may give the user too much freedom and can be more error prone. Useful for variables which are free form text.

Examples
  • City Location
  • Name
  • Ticker symbol for a financial app
  • API Key
  • JSON

Number

Simple numeric field for the user to enter.

Select

A discreet preloaded list of strings for the user to pick. The user can only pick one value.

Examples
  • Currency list
  • Type of weather to show
  • News source from a list

Multi-select

A discreet preloaded list of strings for the user to pick. The user can pick multiple values.

Arrays

A list of values. Any type of variable can be specified here for the user to specify multiple values of.

Private Variables

Once added, it will appear in the Widget Designer as a variable in the Widget function signature.

info

Private variables are constant, and are only set by the author of the Widget. Users installing the Widget only need to specify Public Variables

Private Variables are secret variables which are not shown to the user. They can only be entered once, and afterwards, they will not be visible or modifiable. They are safely and securely stored, and not accessible by anyone (including you) once set. If you need to make amendments, delete the Private Variable and re-enter it. Private Variables are used for API keys, passwords, etc.

info

When a Widget is forked, the Private Variables are not forked over.